﻿using System;
using System.Diagnostics;

namespace LuceneApiServerLib
{
    public enum Store
    {
        YES,
        NO
    }

    public enum Index
    {
        NO,
        ANALYZED,
        NOT_ANALYZED,
        NOT_ANALYZED_NO_NORMS,
        ANALYZED_NO_NORMS
    }

    public enum TermVector
    {
        NO,
        YES,
        WITH_POSITIONS,
        WITH_OFFSETS,
        WITH_POSITIONS_OFFSETS
    }

    /// <summary>
    ///     表示字段信息
    /// </summary>
    [Serializable]
    [DebuggerDisplay("Name ={Name}, Value = {Value}, Index = {Index},Store = {Store}")]
    public class LnField
    {
        /// <summary>
        ///     获取或设置字段名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        ///     获取或设置值
        /// </summary>
        public string Value { get; set; }

        /// <summary>
        ///     设置分词
        /// </summary>
        public Index Index { get; set; }

        /// <summary>
        ///     设置存储
        /// </summary>
        public Store Store { get; set; }
    }

    /// <summary>
    ///     index 特性
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class FieldAttribute : Attribute
    {
        public FieldAttribute(Store store, Index index)
        {
            Store = store;
            Index = index;
        }

        public FieldAttribute()
            : this(Store.YES, Index.ANALYZED)
        {
        }
        public Store Store { set; get; }
        public Index Index { set; get; }
    }
}